package com.necer.base;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;

import com.example.ovulationperiodtracker.R;
import com.gyf.immersionbar.ImmersionBar;

public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActivity {

    protected VB binding;
    protected Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;
        binding = createBinding(getLayoutInflater());
        setContentView(binding.getRoot());
        ImmersionBar.with(this).statusBarDarkFont(true).navigationBarColor(R.color.white).init();
        onCreated(savedInstanceState);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        binding = null;
    }

    protected abstract VB createBinding(LayoutInflater inflater);
    protected abstract void onCreated(Bundle savedInstanceState);
}